package com.teach.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.teach.dto.HotelRoomInfoDTO;
import com.teach.dto.HotelRoomInfoSearch;
import com.teach.dto.UserSearch;
import com.teach.entity.HotelRoomInfo;
import com.teach.entity.UserInfo;

public interface HotelRoomInfoMapper {
    int deleteByPrimaryKey(Integer roomId);

    int insert(HotelRoomInfo record);

    int insertSelective(HotelRoomInfo record);

    HotelRoomInfo selectByPrimaryKey(Integer roomId);

    int updateByPrimaryKeySelective(HotelRoomInfo record);

    int updateByPrimaryKey(HotelRoomInfo record);
    
    @Select("select * from hotel_room_info where shop_id=#{id} and room_type_id=#{roomTypeId}")
	HotelRoomInfo getByTypeIdAndShopId(Long id,Integer roomTypeId);

    
    /**
           * 修改房间数量
     * @param record
     * @return
     */
    int updateByShopIdAndTypeId(HotelRoomInfo record);
    
	@Select("select * from hotel_room_info")
	List<HotelRoomInfo> selectAll();
	/**
	 * 根据房间类型编号查询房间类型名称
	 * @param roomTypeId 房间类型编号
	 * @return
	 */
	@Select("select * from hotel_room_info where room_type_id=#{roomTypeId}")
	HotelRoomInfo selectByRoomTypeId(Integer roomTypeId);
	
	/**
	 * 根据店铺编号查询所有房间信息和房间类型名称
	 * @param id 店铺编号
	 * @return
	 */
	@Select("select A.*,B.room_type_name from hotel_room_info as A INNER JOIN hotel_room_type as B "
			+ "on A.shop_id=#{id} and A.room_type_id=B.room_type_id ")
	List<HotelRoomInfoDTO> selectByShopId(Long id);
	/**
	 * 根据店铺编号和房间类型编号查询房间价格
	 * @param id 店铺编号
	 * @param roomTypeId 房间类型编号
	 * @return
	 */
	@Select("select room_market_price,room_platform_price from hotel_room_info where shop_id=#{id} and room_type_id=#{roomTypeId}")
	HotelRoomInfo getPrice(Long id,Integer roomTypeId);
	
	/**
	 * 获取房间数量
	 * @param id
	 * @param roomTypeId
	 * @return
	 */
	@Select("select room_num from hotel_room_info where shop_id=#{id} and room_type_id=#{roomTypeId}")
	int getRoomNum(Long id,Integer roomTypeId);
	
	List<HotelRoomInfo> select(HotelRoomInfoSearch search);
	
}